﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DataAccess.ObjectTwo
{
   public class D_Search
    {
        DataTable tb = new DataTable();
        ConnectionToDataBase ex = new ConnectionToDataBase();
        public DataTable loadCompany(int val)
        {
            SqlParameter[] sqlParameters = new SqlParameter[1];
            sqlParameters[0] = new SqlParameter("@v_CCode", SqlDbType.Int);
            sqlParameters[0].Value = val;
            return ex.executeSelectQuery("SearchCompany", sqlParameters);
        }
        public DataTable loadCity(int val)
        {
            SqlParameter[] sqlParameters = new SqlParameter[1];
            sqlParameters[0] = new SqlParameter("@v_CCode", SqlDbType.Int);
            sqlParameters[0].Value = val;
            return ex.executeSelectQuery("SearchCity", sqlParameters);
        }
        public DataTable loadBran(int val)
        {
            SqlParameter[] sqlParameters = new SqlParameter[1];
            sqlParameters[0] = new SqlParameter("@v_CCode", SqlDbType.Int);
            sqlParameters[0].Value = val;
            return ex.executeSelectQuery("SearchBranchID", sqlParameters);
        }
        public DataTable loadDistance(int val)
        {
            SqlParameter[] sqlParameters = new SqlParameter[1];
            sqlParameters[0] = new SqlParameter("@v_CCode", SqlDbType.Int);
            sqlParameters[0].Value = val;
            return ex.executeSelectQuery("SearchDistance", sqlParameters);
        }
        public DataTable loadService(int val)
        {
            SqlParameter[] sqlParameters = new SqlParameter[1];
            sqlParameters[0] = new SqlParameter("@v_CCode", SqlDbType.Int);
            sqlParameters[0].Value = val;
            return ex.executeSelectQuery("SearchSERVICES_ID", sqlParameters);
        }
        public DataTable loadNews(int val)
        {
            SqlParameter[] sqlParameters = new SqlParameter[1];
            sqlParameters[0] = new SqlParameter("@v_CCode", SqlDbType.Int);
            sqlParameters[0].Value = val;
            return ex.executeSelectQuery("LoadNews", sqlParameters);
        }
        public DataTable loadFeePolicy(int val)
        {
            SqlParameter[] sqlParameters = new SqlParameter[1];
            sqlParameters[0] = new SqlParameter("@v_CCode", SqlDbType.Int);
            sqlParameters[0].Value = val;
            return ex.executeSelectQuery("SearchFeePolicy", sqlParameters);
        }
        public DataTable loadBranchCity(int val)
        {
            SqlParameter[] sqlParameters = new SqlParameter[1];
            sqlParameters[0] = new SqlParameter("@v_CCode", SqlDbType.Int);
            sqlParameters[0].Value = val;
            return ex.executeSelectQuery("SearchCITY_ID", sqlParameters);
        }
        public DataTable loadEmploy(int val)
        {
            SqlParameter[] sqlParameters = new SqlParameter[1];
            sqlParameters[0] = new SqlParameter("@v_CCode", SqlDbType.Int);
            sqlParameters[0].Value = val;
            return ex.executeSelectQuery("SearchEmployee_ID", sqlParameters);
        }
        public DataTable loadOrder(String val)
        {
            SqlParameter[] sqlParameters = new SqlParameter[1];
            sqlParameters[0] = new SqlParameter("@v_CCode", SqlDbType.VarChar);
            sqlParameters[0].Value = val;
            return ex.executeSelectQuery("SearchOrder", sqlParameters);
        }
        public DataTable SearchOder(int a,int b,String c,int d,String e,String f,int r)
        {
            SqlParameter[] sqlParameters = new SqlParameter[7];
            sqlParameters[0] = new SqlParameter("@A", SqlDbType.Int);
            sqlParameters[0].Value = a;
            sqlParameters[1] = new SqlParameter("@B", SqlDbType.Int);
            sqlParameters[1].Value = b;
            sqlParameters[2] = new SqlParameter("@C", SqlDbType.VarChar);
            sqlParameters[2].Value = c;
            sqlParameters[3] = new SqlParameter("@D", SqlDbType.Int);
            sqlParameters[3].Value = d;
            sqlParameters[4] = new SqlParameter("@E", SqlDbType.VarChar);
            sqlParameters[4].Value = e;
            sqlParameters[5] = new SqlParameter("@F", SqlDbType.VarChar);
            sqlParameters[5].Value = f;
            sqlParameters[6] = new SqlParameter("@R", SqlDbType.Int);
            sqlParameters[6].Value = r;
            return ex.executeSelectQuery("SearchOrderPro", sqlParameters);
        }
    }
}
